const fs = require("fs");

let user = { username: "admin1", password: "12345" };

let data = fs.readFileSync("persons.json", "utf8");
let arr = JSON.parse(data);
let a = arr.find(
  (item) => item.username === user.username && item.password === user.password
);

// if (a) {
//     console.log('登陆成功');
// } else {
//     console.log('用户名或密码错误');
// }
a ? console.log("登陆成功") : console.log("用户名或密码错误");
